// router/index.js
import { createRouter, createWebHashHistory } from 'vue-router';

import index from '../components/view/index.vue';
import classify from '../components/view/classify.vue';
import shopping from '../components/view/shopping.vue';
import account from '../components/view/account.vue';

// 定义应用的路由列表
const routes = [
  {
    path: '/',
    name: 'index',
    component: index,
  },
  {
    path: '/classify', 
    name: 'classify',
    component: classify,
  },
  {
    path: '/shopping', 
    name: 'shopping',
    component: shopping,
  },
  {
    path: '/account', 
    name: 'account',
    component: account,
  },
];

// 创建路由器实例
const router = createRouter({
  // 使用hash模式进行路由管理，无需配置基底URL
  history: createWebHashHistory(),
  routes, // 将上面定义的路由规则传递给路由器
});

// 导出路由器实例，以便在main.js中使用
export default router;